package cn.ssm.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import cn.ssm.biz.TeacherBiz;
import cn.ssm.dao.TeacherMapper;
import cn.ssm.pojo.Pager;
import cn.ssm.pojo.Teacher;

@Service("TeacherBizImpl")
public class TeacherBizImpl implements TeacherBiz {
    @Autowired
    @Qualifier("TeacherMapper")
	private TeacherMapper teacherMapper;
	
	public TeacherMapper getTeacherMapper() {
		return teacherMapper;
	}

	public void setTeacherMapper(TeacherMapper teacherMapper) {
		this.teacherMapper = teacherMapper;
	}

	@Override
	public List<Teacher> getTeacherList(Pager pager) {
		int form =(pager.getCurrentPage()-1)*(pager.getRowPerPage());
		
		return teacherMapper.getTeacherList(form, pager.getRowPerPage());
	}

	@Override
	public int deleteTeacher(Integer id) {
		// TODO Auto-generated method stub
		return teacherMapper.deleteTeacher(id);
	}

	@Override
	public int addTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		return teacherMapper.addTeacher(teacher);
	}

	@Override
	public int updateTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		return teacherMapper.updateTeacher(teacher);
	}

	@Override
	public int findTeaCount() {
		// TODO Auto-generated method stub
		return teacherMapper.selectTeaCount();
	}

	@Override
	public Teacher getTeacherListById(int id) {
		// TODO Auto-generated method stub
		return teacherMapper.getTeacherListById(id);
	}

	@Override
	public List<Teacher> getTeacherList1() {
		// TODO Auto-generated method stub
		return teacherMapper.getTeacherList1();
	}

	@Override
	public int findIdByName(String name) {
		// TODO Auto-generated method stub
		return teacherMapper.selectIdByName(name);
	}

}
